CREATE TABLE `SRAnalytics`.`MsgLiveSurfaceCurve` (
`ekey_at` ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') NOT NULL DEFAULT 'None',
`ekey_ts` ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','EUX','ANY','CXE','DXE','NXAM','NXBR','NXLS','NXML','NXOS','NXP','EUREX','CEDX','ICEFE') NOT NULL DEFAULT 'None',
`ekey_tk` VARCHAR(12) NOT NULL DEFAULT '',
`ekey_yr` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`ekey_mn` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`ekey_dy` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`surfaceType` ENUM('None','Live','PrevDay','Interp','Close','Test') NOT NULL DEFAULT 'None',
`ticker_at` ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') NOT NULL DEFAULT 'None' COMMENT 'underlying stock key that this option expiration attaches to',
`ticker_ts` ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','EUX','ANY','CXE','DXE','NXAM','NXBR','NXLS','NXML','NXOS','NXP','EUREX','CEDX','ICEFE') NOT NULL DEFAULT 'None' COMMENT 'underlying stock key that this option expiration attaches to',
`ticker_tk` VARCHAR(12) NOT NULL DEFAULT '' COMMENT 'underlying stock key that this option expiration attaches to',
`fkey_at` ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') NOT NULL DEFAULT 'None' COMMENT 'underlying future key (if any)',
`fkey_ts` ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','EUX','ANY','CXE','DXE','NXAM','NXBR','NXLS','NXML','NXOS','NXP','EUREX','CEDX','ICEFE') NOT NULL DEFAULT 'None' COMMENT 'underlying future key (if any)',
`fkey_tk` VARCHAR(12) NOT NULL DEFAULT '' COMMENT 'underlying future key (if any)',
`fkey_yr` SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'underlying future key (if any)',
`fkey_mn` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'underlying future key (if any)',
`fkey_dy` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'underlying future key (if any)',
`uPrcDriverKey_at` ENUM('None','EQT','IDX','BND','CUR','COM','FUT','SYN','WAR','FLX','MUT','SPD','MM','MF','COIN','TOKEN','ANY') NOT NULL DEFAULT 'None' COMMENT 'underlier driver key',
`uPrcDriverKey_ts` ENUM('None','SR','NMS','CME','ICE','CFE','CBOT','NYMEX','COMEX','RUT','CIDX','ARCA','NYSE','OTC','NSDQ','MFQS','MIAX','DJI','CUSIP','ISIN','BXE','EUX','ANY','CXE','DXE','NXAM','NXBR','NXLS','NXML','NXOS','NXP','EUREX','CEDX','ICEFE') NOT NULL DEFAULT 'None' COMMENT 'underlier driver key',
`uPrcDriverKey_tk` VARCHAR(12) NOT NULL DEFAULT '' COMMENT 'underlier driver key',
`uPrcDriverKey_yr` SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'underlier driver key',
`uPrcDriverKey_mn` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'underlier driver key',
`uPrcDriverKey_dy` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'underlier driver key',
`uPrcDriverType` ENUM('None','Stock','Future','Option','MLeg') NOT NULL DEFAULT 'None' COMMENT 'underlier driver key type (stock or future)',
`uPrcDriver` DOUBLE NOT NULL DEFAULT 0 COMMENT 'underlier driver (mid-market)',
`uPrc` DOUBLE NOT NULL DEFAULT 0 COMMENT 'effective uPrc used for surface fitting',
`uBid` DOUBLE NOT NULL DEFAULT 0 COMMENT 'effective uBid',
`uAsk` DOUBLE NOT NULL DEFAULT 0 COMMENT 'effective uAsk',
`years` FLOAT NOT NULL DEFAULT 0 COMMENT 'time to expiration (in years)',
`rate` FLOAT NOT NULL DEFAULT 0 COMMENT 'average interest rate to expiration (SR global rate curve)',
`sdiv` FLOAT NOT NULL DEFAULT 0 COMMENT 'stock dividend (borrow rate)',
`ddiv` FLOAT NOT NULL DEFAULT 0 COMMENT '(expected) cumulative discrete dividend $ amounts prior to expiration',
`ddivPv` FLOAT NOT NULL DEFAULT 0 COMMENT '(expected) cumulative npv of discrete dividend $ amounts prior to expiration (SR global rate curve)',
`ddivSource` ENUM('None','Announced','Forecast') NOT NULL DEFAULT 'None' COMMENT 'Forecast if any of the dividends prior to expiry are forecast rather than announced',
`symbolRatio` FLOAT NOT NULL DEFAULT 0 COMMENT 'underlier price ratio (usually 1.0 or a multi-hedge option price ratio; if one exists)',
`exType` ENUM('None','American','European','Asian','Cliquet') NOT NULL DEFAULT 'None' COMMENT 'exercise type (American or European)',
`modelType` ENUM('None','LogNormalExact','NormalExact','LogNormalApprox','NormalApprox') NOT NULL DEFAULT 'None' COMMENT 'option pricing model used for price calcs (Normal, LogNormal, etc.)',
`priceType` ENUM('None','Equity','Future') NOT NULL DEFAULT 'None' COMMENT 'Equity has independent sdiv and rate, Future has sdiv = rate',
`earnCnt` FLOAT NOT NULL DEFAULT 0 COMMENT 'number of qualifying earnings events prior to expiration [can be fractional] (from StockEarningsCalendar)',
`earnCntAdj` FLOAT NOT NULL DEFAULT 0 COMMENT 'number of qualifying earnings events prior to expiration [adjusted] (from StockEarningsCalendar + LiveSurfaceTerm)',
`axisVolRT` FLOAT NOT NULL DEFAULT 0 COMMENT 'axis volatility x sqrt(years) (used to compute xAxis) [usually 4m atm vol]',
`axisFUPrc` FLOAT NOT NULL DEFAULT 0 COMMENT 'axis FwdUPrc (fwd underlying price used to compute xAxis)',
`synSpot` DOUBLE NOT NULL DEFAULT 0 COMMENT 'Synthetic spot price (market-derived spot when the underlying is not a traded instrument)',
`synCarry` DOUBLE NOT NULL DEFAULT 0 COMMENT 'Synthetic carry rate; corresponds to the relationship between uPrc and synSpot (set when the underlying is not a traded instrument)',
`atmStrike` FLOAT NOT NULL DEFAULT 0 COMMENT 'synthetic strike with cPrice = pPrice',
`moneynessType` ENUM('None','PctStd','LogStd','NormStd') NOT NULL DEFAULT 'None' COMMENT 'moneyness (xAxis) convention',
`underlierMode` ENUM('None','Actual','FrontMonth','UPrcAdj') NOT NULL DEFAULT 'None' COMMENT 'underlier pricing mode (None=use spot/stock market; FrontMonth=use front month future market * uPrcRatio; Actual = use actual underlier future market)',
`cpAdjType` ENUM('None','SDiv','UPrcRatio') NOT NULL DEFAULT 'None' COMMENT 'adjustment used to align calls/puts (if any)',
`priceQuoteType` ENUM('None','Price','Vol') NOT NULL DEFAULT 'None' COMMENT 'Price or Vol',
`atmVol` FLOAT NOT NULL DEFAULT 0 COMMENT 'atm vol (xAxis = 0)',
`atmCen` FLOAT NOT NULL DEFAULT 0 COMMENT 'atm vol (xAxis = 0) (eMove/earnCntAdj censored)',
`atmVolHist` FLOAT NOT NULL DEFAULT 0 COMMENT 'historical realized volatility (includes eMoveHist x earnCntAdj adjustment). Note that this is the default atmVol if no implied markets existed previous day.',
`atmCenHist` FLOAT NOT NULL DEFAULT 0 COMMENT 'censored (earnings events removed) historical realized volatility. Trailing periods is 2x forward time to expiration. From HistoricalVolatility(windowType=hlCen).mv_nnn',
`eMove` FLOAT NOT NULL DEFAULT 0 COMMENT 'implied earnings move (from LiveSurfaceTerm)',
`eMoveHist` FLOAT NOT NULL DEFAULT 0 COMMENT 'historical earnings move (avg of trailing 8 moves). From StockEarningsCalendar.eMoveHist',
`uPrcRatio` DOUBLE NOT NULL DEFAULT 0 COMMENT 'uPrcAdj = uPrc * uPrcRatioFit',
`minAtmVol` FLOAT NOT NULL DEFAULT 0 COMMENT 'minimum estimated atm vol',
`maxAtmVol` FLOAT NOT NULL DEFAULT 0 COMMENT 'maximum estimated atm vol',
`minCPAdjVal` DOUBLE NOT NULL DEFAULT 0 COMMENT 'minimum cpAdjVal (sdiv or uPrcRatio)',
`maxCPAdjVal` DOUBLE NOT NULL DEFAULT 0 COMMENT 'minimum cpAdjVal (sdiv or uPrcRatio)',
`atmFixedMove` FLOAT NOT NULL DEFAULT 0 COMMENT 'fixed strike atm move from prior period',
`atmPhi` FLOAT NOT NULL DEFAULT 0 COMMENT 'surface phi @ xAxis = 0',
`atmRho` FLOAT NOT NULL DEFAULT 0 COMMENT 'surface rho @ xAxis = 0',
`atmVega` FLOAT NOT NULL DEFAULT 0 COMMENT 'surface vega @ xAxis = 0',
`slope` FLOAT NOT NULL DEFAULT 0 COMMENT 'volatility surface slope (dVol / dXAxis) @ ATM (xAxis=0)',
`varSwapFV` FLOAT NOT NULL DEFAULT 0 COMMENT 'variance swap fair value (estimated by numerical integration over OTM price surface)',
`gridType` ENUM('None','Unused','SRCubic','SRCubic2','BSpline','BSpline2') NOT NULL DEFAULT 'None' COMMENT 'gridType defines skew curve coeff points + spline type',
`knotShift` FLOAT NOT NULL DEFAULT 0 COMMENT 'constant that should be added to each base knot location [-3.0 - +3.0]',
`fitPowerC` FLOAT NOT NULL DEFAULT 0 COMMENT 'fit power of the vol fit (call wing)',
`fitPowerP` FLOAT NOT NULL DEFAULT 0 COMMENT 'fit power of the vol fit (put wing)',
`minXAxis` FLOAT NOT NULL DEFAULT 0 COMMENT 'minimum xAxis value; xAxis values to the left extrapolate horizontally',
`maxXAxis` FLOAT NOT NULL DEFAULT 0 COMMENT 'maximum xAxis value; xAxis values to the right extrapolate horizontally',
`asymptoticVolC` FLOAT NOT NULL DEFAULT 0 COMMENT 'asymptotic volatility (call wing)',
`asymptoticVolP` FLOAT NOT NULL DEFAULT 0 COMMENT 'asymptotic volatility (put wing)',
`minCurvValue` FLOAT NOT NULL DEFAULT 0 COMMENT 'minimum curvature (2nd derivative) of skew curve (can be negative if curve is not strictly convex)',
`minCurvXAxis` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis of minimum curvature point',
`maxCurvValue` FLOAT NOT NULL DEFAULT 0 COMMENT 'maximum curvature (2nd derivative) of skew curve',
`maxCurvXAxis` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis of maximum curvature point',
`skewMinX` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = (effStrike / effAxisFUPrc - 1.0) / axisVolRT; effStrike = strike * strikeRatio; effAxisFUPrc = axisFUPrc * symbolRatio',
`skewMinY` FLOAT NOT NULL DEFAULT 0 COMMENT 'skewMinX / skewMinY are the skew curve minimum point (usually a positive x value and a negative y value)',
`surfaceFit` ENUM('None','Flat','Linear','Quadratic','ConvexSpline','SplitSpline','Interp','Recent','PCA','Median','Default') NOT NULL DEFAULT 'None',
`skewC00` FLOAT NOT NULL DEFAULT 0 COMMENT 'curve coeff[0]',
`skewC01` FLOAT NOT NULL DEFAULT 0 COMMENT 'curve coeff[1]',
`skewC02` FLOAT NOT NULL DEFAULT 0,
`skewC03` FLOAT NOT NULL DEFAULT 0,
`skewC04` FLOAT NOT NULL DEFAULT 0,
`skewC05` FLOAT NOT NULL DEFAULT 0,
`skewC06` FLOAT NOT NULL DEFAULT 0,
`skewC07` FLOAT NOT NULL DEFAULT 0,
`skewC08` FLOAT NOT NULL DEFAULT 0,
`skewC09` FLOAT NOT NULL DEFAULT 0,
`skewC10` FLOAT NOT NULL DEFAULT 0,
`skewC11` FLOAT NOT NULL DEFAULT 0,
`skewC12` FLOAT NOT NULL DEFAULT 0,
`skewC13` FLOAT NOT NULL DEFAULT 0,
`skewC14` FLOAT NOT NULL DEFAULT 0,
`skewC15` FLOAT NOT NULL DEFAULT 0,
`skewC16` FLOAT NOT NULL DEFAULT 0,
`skewC17` FLOAT NOT NULL DEFAULT 0,
`skewC18` FLOAT NOT NULL DEFAULT 0,
`skewC19` FLOAT NOT NULL DEFAULT 0,
`skewC20` FLOAT NOT NULL DEFAULT 0,
`skewC21` FLOAT NOT NULL DEFAULT 0,
`skewC22` FLOAT NOT NULL DEFAULT 0,
`skewC23` FLOAT NOT NULL DEFAULT 0,
`skewC24` FLOAT NOT NULL DEFAULT 0,
`skewC25` FLOAT NOT NULL DEFAULT 0,
`skewC26` FLOAT NOT NULL DEFAULT 0,
`skewC27` FLOAT NOT NULL DEFAULT 0,
`skewC28` FLOAT NOT NULL DEFAULT 0,
`ivAdjD07` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = -5.0',
`ivAdjD06` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = -4.0',
`ivAdjD05` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = -3.0',
`ivAdjD04` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = -2.0',
`ivAdjD03` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = -1.5',
`ivAdjD02` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = -1.0',
`ivAdjD01` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = -0.5',
`ivAdjU01` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = +0.5',
`ivAdjU02` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = +1.0',
`ivAdjU03` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = +1.5',
`ivAdjU04` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = +2.0',
`ivAdjU05` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = +3.0',
`ivAdjU06` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = +4.0',
`ivAdjU07` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = +5.0',
`cpAdjD04` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = -4.0',
`cpAdjD03` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = -3.0',
`cpAdjD02` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = -2.0',
`cpAdjD01` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = -1.0',
`cpAdjU01` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = +1.0',
`cpAdjU02` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = +2.0',
`cpAdjU03` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = +3.0',
`cpAdjU04` FLOAT NOT NULL DEFAULT 0 COMMENT 'xAxis = +4.0',
`pwidth` FLOAT NOT NULL DEFAULT 0 COMMENT 'minimum mkt premium width',
`vwidth` FLOAT NOT NULL DEFAULT 0 COMMENT 'minimum mkt volatility width',
`cCnt` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'num call strikes in base fit',
`pCnt` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'num put strikes in base fit',
`cBidMiss` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'number of call bid violations (surface outside the market)',
`cAskMiss` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'number of call ask violations (surface outside the market)',
`pBidMiss` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'number of put bid violations',
`pAskMiss` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'number of put ask violations',
`fitAvgErr` FLOAT NOT NULL DEFAULT 0 COMMENT 'average error (sPrc - midPrc)',
`fitAvgAbsErr` FLOAT NOT NULL DEFAULT 0 COMMENT 'average absolute error (sPrc - midPrc)',
`fitMaxPrcErr` FLOAT NOT NULL DEFAULT 0 COMMENT 'worst case surface premium violation',
`fitErrXX` FLOAT NOT NULL DEFAULT 0 COMMENT 'okey_xx of the option with the largest fit error in this expiration',
`fitErrCP` ENUM('Call','Put','Pair') NOT NULL DEFAULT 'Call' COMMENT 'okey_cp of the option with the largest fit error in this expiration',
`fitErrDe` FLOAT NOT NULL DEFAULT 0 COMMENT 'delta of fixErrXX',
`fitErrBid` FLOAT NOT NULL DEFAULT 0 COMMENT 'bid of the option with the largest fit error',
`fitErrAsk` FLOAT NOT NULL DEFAULT 0 COMMENT 'ask of the option with the largest fit error',
`fitErrPrc` FLOAT NOT NULL DEFAULT 0 COMMENT 'surface prc of the option with the largest fit error',
`fitErrVol` FLOAT NOT NULL DEFAULT 0 COMMENT 'surface vol of the option with the largest fit error',
`numSaddlePts` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'number of saddle points',
`minSaddleSpan` FLOAT NOT NULL DEFAULT 0 COMMENT 'smallest distance between saddle points',
`maxSaddleCurvature` FLOAT NOT NULL DEFAULT 0 COMMENT 'maximum saddle point curvature',
`skewCounter` INT NOT NULL DEFAULT 0 COMMENT 'skew surface fit counter',
`sdivCounter` INT NOT NULL DEFAULT 0 COMMENT 'sdiv surface fit counter',
`tradingSession` ENUM('None','RegularMkt','PreMkt','PostMkt','PostMktETF','NextDay','MktClosed','Rotation') NOT NULL DEFAULT 'None' COMMENT 'trading session this surface is from',
`tradeableStatus` ENUM('None','OK','SurfaceErr','LowCCnt','LowPCnt','FitPrcErr','BidAskMiss','LowCounter','DefaultSkew','SessionMiss','BaseErr','SwitchDelay','WideMktV','WideMktP','WideUMkt','UWidthEma','CCntEma','PCntEma','VWidthEma','PWidthEma','Closed') NOT NULL DEFAULT 'None' COMMENT 'indicates whether the surface is currently tradeable or not (all server surface integrity checks pass)',
`surfaceResult` ENUM('None','OK','EOD','Init','Cache','PrevDay','NullExpIdx','NoStrikes','NoBaseCurve','BadBootAtm','NoGoodStrikes','BadAtmVol','Bootstrap','NoUPrc','NoIVols','NoModelPts','ZeroYears','NoSimpleVol','OptMktNotOpn','NoBaseSurface','UPrcOffCnt','SkewKnotCnt','Exception','AxisError','CAskFit1Err','CAskFit2Err','PAskFit1Err','PAskFit2Err','CBidFit1Err','CBidFit2Err','PBidFit1Err','PBidFit2Err','CobsSampleErr','NoPrcFit','NumStrikes','CMidFitErr','PMidFitErr','StrikeCount','VolKnotCnt','InterpError','NoAtmStrike','CobsConvexFitErr','CobsMidFitErr','ProxyError','NoOptExp','Expired','NoUnderlier','NoBaseUnderlier','InvalidUPrc','ZeroUPrc','WideUMkt','StalePrcFit','NoPrcCurves','PriceError','ConvergeFail','NoUPrcRatio','NoSDivValue') NOT NULL DEFAULT 'None',
`sTimestamp` DATETIME(6) NOT NULL DEFAULT '1900-01-01 00:00:00.000000' COMMENT 'last surface curve fit timestamp',
`time` TIME(6) NOT NULL DEFAULT '00:00:00.000000',
`timestamp` DATETIME(6) NOT NULL DEFAULT '1900-01-01 00:00:00.000000',
PRIMARY KEY USING HASH (`ekey_tk`,`ekey_yr`,`ekey_mn`,`ekey_dy`,`ekey_at`,`ekey_ts`,`surfaceType`)
) ENGINE=SRSE DEFAULT CHARSET=LATIN1 COMMENT='LiveSurfaceCurve (surfaceType = \'Live\') records are computed and publish continuously during trading hours and represent a current best implied volatility market fit.\nSurfaceType = \'PriorDay\' records contain the `closing surface record from the prior trading period (usually from just before the last main session close).';